package com.example.commuity.adapter

import com.chad.library.adapter.base.BaseProviderMultiAdapter
import com.example.commuity.adapter.provider.RecommendFollowAdapter
import com.example.commuity.adapter.provider.SquareCardViewProvider
import com.example.commuity.entity.HorizontalScrollCardEntity
import com.example.commuity.entity.viewdata.RecommendFollowViewData
import com.example.entity.BaseEntity

class RecommendAdapter  : BaseProviderMultiAdapter<BaseEntity>(){


    init {
        addItemProvider(SquareCardViewProvider())
        addItemProvider(RecommendFollowAdapter())
    }


    override fun getItemType(data: List<BaseEntity>, position: Int): Int {
       var itemEntity =data[position]

        return when(itemEntity){
            is HorizontalScrollCardEntity->RecommendItemType.SQUARE_CARD_VIEW
            is RecommendFollowViewData->RecommendItemType.COMMUNITY_CARD_VIEW
            else ->RecommendItemType.DEFAULT_VIEW
        }
    }
}